<template>
  <div>
    <ul>
      <li>
        <router-link to="/contacts/allcontacts">All_contacts</router-link>
      </li>
      <li><router-link to="/contacts/alice">Alice</router-link></li>
      <li><router-link to="/contacts/Bob">Bob</router-link></li>
    </ul>
    <button @click="btn">随机显示</button>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      path: ["/contacts/allcontacts", "/contacts/alice", "/contacts/Bob"],
    };
  },
  methods: {
    btn() {
      let i = Math.floor(Math.random() * 3);
      this.$router.replace({
        path: this.path[i],
      });
    },
  },
};
</script>

<style>
</style>